Infix notation

Prefix notation
Infix notation
Postfix notation

Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on (e.g. 2 + 2). It is not as simple to parse by computers as prefix notation ( e.g. + 2 2 ) or postfix notation ( e.g. 2 2 + ), but many programming languages use it due to its familiarity.

In infix notation, unlike in prefix or postfix notations, parentheses surrounding groups of operands and operators are necessary to indicate the intended order in which operations are to be performed. In the absence of parentheses, certain precedence rules determine the order of operations.

Infix notation may also be distinguished from function notation, where the name of a function suggests a particular operation, and its arguments are the addends. An example of such a function notation would be S(1,3) in which the function S denotes addition: S(1,3) = 1+3 = 4.

Examples of Infix Notation

(1 × 23) - 3 + 4 × 5 would be evaluated as:

  (1 × 2 ^ 3) - 3 + 4 × 5
= (1 × 8) - 3 + 4 × 5
= 8 - 3 + 4 × 5
= 8 - 3 + 20
= 5 + 20
= 25

See also

External links